#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Point{
    int x,y;
};
int dx[4]={0,0,-1,1};
int dy[4]={1,-1,0,0};
int main() {

    int n;
    cin>>n;
    vector<vector<char>> vecMap(n,vector<char>(n));
    vector<Point> vecHouses;
    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            cin>>vecMap[i][j];
            if(vecMap[i][j]=='#'){
                vecHouses.push_back({i,j});
            }
        }
    }
    int nCnt=0,nSum=0;
    vector<vector<bool>> vecFlg(n,vector<bool>(n));
    for(const Point& house : vecHouses){
        if(vecFlg[house.x][house.y]){
            continue;
        }
        ++nCnt;
        vecFlg[house.x][house.y]=true;   
        queue<Point> q;
        q.push(house);
        
        vector<Point> vecBlocks;
        vector<Point> vecBlockHouse;
        while(q.size()){
            Point u=q.front();
            q.pop();
            if(vecMap[u.x][u.y]=='#'){
                vecBlockHouse.push_back(u);
            }
            vecBlocks.push_back(u);
            for(int i=0;i<4;++i){
                int nx=u.x+dx[i];
                int ny=u.y+dy[i];
                if(nx<0 || nx>=n || ny<0 || ny>=n || vecFlg[nx][ny] || vecMap[nx][ny]=='*'){
                    continue;
                }
                vecFlg[nx][ny]=true;
                q.push({nx,ny});
            }
        }

       	int nBlockSum=0x3f3f3f3f;
        for(const Point& p : vecBlocks){
            vector<vector<int>> vecDist(n,vector<int>(n,-1));
            q.push(p);
            vecDist[p.x][p.y]=0;
            while(q.size()){
                auto u=q.front();
                q.pop();
                for(int i=0;i<4;++i){
                    int nx=u.x+dx[i];
                    int ny=u.y+dy[i];
                    if(nx<0 || ny<0 || nx>=n || ny>=n || vecDist[nx][ny]!=-1 || vecMap[nx][ny]=='*'){
                        continue;
                    }
                    vecDist[nx][ny]=vecDist[u.x][u.y]+1;
                    q.push({nx,ny});
                }
            }
            int nCurSum=0;
            for(const Point& e : vecBlockHouse){
				nCurSum+=vecDist[e.x][e.y];
			}
			nBlockSum=min(nBlockSum,nCurSum);
        }
        nSum+=nBlockSum;
    }
    cout<<nCnt<<' '<<nSum<<endl;
    
    return 0;
}
